import type { HandleTable } from '@/types/handle'
import { req } from '@/util/request'
import type { ResData, Page, PageOprion } from '@/types/index'
import type { MenuHandleAuthData } from '@/types/menu'
export function getAllHandle(page: PageOprion, cdn: HandleTable): ResData<Page<HandleTable>> {
  return req.post('/handle/get/all', {
    size: page.size,
    num: page.num,
    cdn
  })
}
// 新增系统接口
export function addHandle(handle: HandleTable): ResData<number | null> {
  return req.post('/handle/add', handle)
}
//编辑系统接口
export function updateHandle(hadle: HandleTable): ResData<any> {
  return req.post('/handle/update', hadle)
}
// 删除系统接口
export function delHandle(hid: number[]): ResData<MenuHandleAuthData> {
  return req.post('/handle/del', hid)
}

// 接口日志记录
export function changeHlog(hids: number[], log: '1' | '0'): ResData<any> {
  return req.post('/handle/log', {
    hids,
    log
  })
}

/**
 * 系统接口名查询
 */
export function getHandleName(page: PageOprion, cdn: HandleTable): ResData<Page<HandleTable>> {
  return req.post('/handle/get/all', {
    size: page.size,
    num: page.num,
    cdn
  })
}
